#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define lc (o<<1)
#define rc (o<<1|1)
#define mid ((l+r)>>1)
using namespace std;
typedef long long LL;
typedef double db;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=1e6+10,MAX=((1LL<<30)-1);
int n;
struct Seg_T
{
	int sumv[2][MAXN<<2],cov[MAXN<<2];
	void push_up(int o)
	{
		sumv[0][o]=sumv[0][lc]|sumv[0][rc];
		sumv[1][o]=sumv[1][lc]&sumv[1][rc];
		return;
	}
	void push_down(int o)
	{
		if(~cov[o])
		{
			cov[lc]=cov[rc]=sumv[0][lc]=sumv[0][rc]=sumv[1][lc]=sumv[1][rc]=cov[o];
			cov[o]=-1;
		}
		return;
	}
	int query(int o,int l,int r,int k)
	{
		if(l==r)return sumv[0][o];
		push_down(o);
		if(k<=mid)return query(lc,l,mid,k);
		else return query(rc,mid+1,r,k);
	}
	int query0(int o,int l,int r,int k)
	{
		if(!sumv[0][o])return -1;
		if(l==r)return l;
		push_down(o);
		if(k<=mid)
		{
			int t=query0(lc,l,mid,k);
			return ~t?t:query0(rc,mid+1,r,k);
		}
		else return query0(rc,mid+1,r,k);
	}
	int query1(int o,int l,int r,int k)
	{
		if(sumv[1][o]==MAX)return -1;
		if(l==r)return l;
		push_down(o);
		if(k<=mid)
		{
			int t=query1(lc,l,mid,k);
			return ~t?t:query1(rc,mid+1,r,k);
		}
		else return query1(rc,mid+1,r,k);
	}
	void cover(int o,int l,int r,int yl,int yr,int k)
	{
		if(yl<=l&&r<=yr)
		{
			sumv[0][o]=sumv[1][o]=cov[o]=k;
			return;
		}
		push_down(o);
		if(yl<=mid)cover(lc,l,mid,yl,yr,k);
		if(yr>mid)cover(rc,mid+1,r,yl,yr,k);
		push_up(o);
		return;
	}
	void update(int o,int l,int r,int k,int x)
	{
		if(l==r)
		{
			sumv[0][o]+=x;sumv[1][o]+=x;
			return;
		}
		push_down(o);
		if(k<=mid)update(lc,l,mid,k,x);
		else update(rc,mid+1,r,k,x);
		push_up(o);
		return;
	}
	void insert(int k,int x)
	{
		if(!x)return;
		int t=query(1,1,n,k);
		if(x+t<=MAX)update(1,1,n,k,x);
		else 
		{
			update(1,1,n,k,x-MAX-1);
			int pos=query1(1,1,n,k+1);
			if(pos!=k+1)cover(1,1,n,k+1,pos-1,0);
			update(1,1,n,pos,1);
		}
	}
	void del(int k,int x)
	{
		if(!x)return;
		int t=query(1,1,n,k);
		if(t>=x)update(1,1,n,k,-x);
		else 
		{
			update(1,1,n,k,MAX-x+1);
			int pos=query0(1,1,n,k+1);
			if(pos!=k+1)cover(1,1,n,k+1,pos-1,MAX);
			update(1,1,n,pos,-1);
		}
	}
}T1;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	n=read()+2;read();read();read();
	memset(T1.cov,-1,sizeof(T1.cov));
	for(int i=1;i<=n-2;++i)
	{
		int op=read();
		if(op==1)
		{
			int a=read(),b=read(),bloc=b/30+1;
			if(a>0)
			{
				T1.insert(bloc,a<<(b-30*(bloc-1))&MAX);
				T1.insert(bloc+1,a>>(30*bloc-b));
			}
			else if(a<0)
			{
				a=-a;
				T1.del(bloc,a<<(b-30*(bloc-1))&MAX);
				T1.del(bloc+1,a>>(30*bloc-b));
			}
		}
		else
		{
			int x=read(),bloc=x/30+1;
			(1<<(x-30*(bloc-1))&T1.query(1,1,n,bloc))?puts("1"):puts("0");
		}
	}
	return 0;
}
